package com.it.mybatis.spring.sqlSessionFactory;

import com.it.mybatis.spring.sqlSession.DefaultSqlSession;
import com.it.mybatis.spring.sqlSession.SqlSession;

/**
 * @author 胡凯
 * @create 2021/11/25 18:55
 */
public class DefaultSqlSessionFactory implements SqlSessionFactory {
    private Configuration configuration;
    // 通过构造函数绑定属性
    public DefaultSqlSessionFactory(Configuration configuration){
        this.configuration=configuration;
    }
    @Override
    public SqlSession openSession() {
        return new DefaultSqlSession(configuration.connection,configuration.mapperElement);
    }
}
